<!DOCTYPE html>
<html>
<head>
    <title>维护规程详情</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <i-form ref="formValidate" :label-width="80" style="text-align: center">
        <Row>
            <i-col span="6">
                <Form-item label="设备编码">
                    <span>
                        {{devMaintenPlan.devCode}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="版本">
                    <span>
                        {{devMaintenPlan.planVersion}}
                    </span>
                </Form-item>
            </i-col>

        </Row>
        <Row>
            <i-col span="6">
                <Form-item label="内容">
                    <span>
                        {{devMaintenPlan.planCon}}
                    </span>
                </Form-item>
            </i-col>
            <i-col span="6">
                <Form-item label="类型">
                    <span>
                        {{sysEnums.MAINTENPLAN_TYPE[devMaintenPlan.reserve1]}}
                    </span>
                </Form-item>
            </i-col>
        </Row>
    </i-form>
    <Card>
        <Tabs value="record0" type="card">
            <Tab-pane label="规程选项" name="record0">
                <table id="plan_record"></table>
            </Tab-pane>
        </Tabs>
    </Card>
</div>

</body>
<script>
    var plan_id = getQueryString("plan_id");
    let vm ;
    $(function () {

        vm = new Vue({
            el: '#rrapp',
            data: {
                devMaintenPlan: {

                }
            },
            methods: {
                del: function (id) {
                    confirm('确定要删除选中的记录？', function () {
                        Ajax.request({
                            url: "../devplanoption/delete/"+id,
                            async: true,
                            successCallback: function () {
                                alert('操作成功', function (index) {
                                    vm.reload();
                                });
                            }
                        });
                    });
                },
                reload: function (event) {
                    var page = $("#plan_record").jqGrid('getGridParam', 'page');
                    $("#plan_record").jqGrid('setGridParam', {
                        page: page
                    }).trigger("reloadGrid");
                }
            }
        });

        //查询计划数据
        loadRecord(plan_id);
        //获取计划内容
        $("#plan_record").Grid({
            url: '../devplanoption/list?planId='+ plan_id,
            colModel: [
                {label: '选项编码', name: 'code', index: 'CODE', width: 100},
                {label: '选项名称', name: 'name', index: 'NAME', width: 160},
                {label: '设备类型', name: 'devTypeName', index: 'DEV_TYPE_NAME', width: 160},
                {label: '供应厂家', name: 'devSupply', index: 'DEV_SUPPLY', width: 160},
                {label: '检查标准', name: 'checkSt', index: 'CHECK_ST', width: 160},
                {label: '方法手段', name: 'methodType', index: 'METHOD_TYPE', width: 160},
                {label: '选项备注', name: 'remark', index: 'REMARK', width: 160},
                // {label: '生产时间（分钟）', name: 'checkDatePrud', index: 'CHECK_DATE_PRUD', width: 80},
                // {label: '非生产时间（分钟）', name: 'checkDateUprud', index: 'CHECK_DATE_UPRUD', width: 80},
                {
                    label: '实施频率', name: 'preRate', index: 'PRE_RATE', width: 80,
                    formatter: function (value) {
                        return sysEnums.FRERATE[value];
                    }
                },
                {label: '人次', name: 'perEv', index: 'PER_EV', width: 80},
                {label: 'devType', name: 'devType', index: 'DEV_TYPE',  hidden: true},
            ]
        });

    });



    function loadRecord(plan_id){
        Ajax.request({
            url: "../devmaintenplan/info/" + plan_id,
            async: true,
            successCallback: function (r) {
                vm.devMaintenPlan = r.devMaintenPlan;
            }
        });
    }
</script>
</html>
